﻿@model IEnumerable<OurWedding1.Models.Task>
@using OurWedding1
@using OurWedding1.Helpers

<table style="width: 100%">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Deadline)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.isDone)
            </th>
            <th class="colLevel2">
                @Html.DisplayNameFor(model => model.Expens)
            </th>
            <th class="colLevel1">
                @Html.DisplayNameFor(model => model.Guest)
            </th>
            <th class="colLevel2">@Resources.Tasks_Remaining</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.ActionLink(item.Name, "Details", new { id = item.TaskId })
                </td>
                <td>
                    @Html.DisplayFor(model => item.Deadline)
                </td>
                <td>
                    @Html.Partial("_Status", item)
                </td>
                <td class="colLevel2">
                    @(item.Expens == null ? "None" : item.Expens.Name)
                </td>
                <td class="colLevel1">
                    @(item.Guest == null ? "None" : item.Guest.Name)
                </td>
                <td class="colLevel2">@item.DaysLeft() @Resources.Tasks_DaysLeft</td>
                <td class="tdRight">
                    @Html.ActionLink("Edit", "Edit", new { id = item.TaskId }, new { @class = "editIconLink" })
                    @Html.ActionLink("Delete", "Delete", new { id = item.TaskId }, new { @class = "deleteIconLink" })
                    @Html.ExportEventToGoogleLink(item.Name, item.Deadline.Value, item.Deadline.Value,HttpUtility.UrlEncode(String.Format("{0} - {1} / {2}:{3}",Resources.Wedding,item.Expens.Wedding.Name,Resources.Expense,item.Expens.Name)), "", Resources.Calendar_Google_Event_Add,new { @class = "calendarIconLink", title=Resources.Calendar_Google_Event_Add})
                </td>
            </tr>
        }
    </tbody>
</table>

